#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TableIntegralTaskDao:DaoBase<TableIntegralTask>
    {
        public override string GetFileName()
        {
            return "TableIntegralTask.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimaryInt = new Dictionary<int, TableIntegralTask>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddPrimaryIndex(TableIntegralTask model)
        {
            #if UNITY_EDITOR
            if(cachePrimaryInt.ContainsKey(model.taskId)) UnityEngine.Debug.LogError("数据表id重复:TableIntegralTask->id: " + model.taskId);
            #endif
            cachePrimaryInt[model.taskId] = model;
        }
        protected override TableIntegralTask ParseRowData(string[] rowData)
        {
            TableIntegralTask data = new TableIntegralTask();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.taskId = int.Parse(rowData[0]);
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.taskName = rowData[1];
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.taskTarget = rowData[2];
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.taskReward = rowData[3];
            }
            if (!string.IsNullOrEmpty(rowData[4]))
            {
                data.taskRandom = int.Parse(rowData[4]);
            }
            if (!string.IsNullOrEmpty(rowData[5]))
            {
                data.taskIcon = rowData[5];
            }
            if (!string.IsNullOrEmpty(rowData[6]))
            {
                data.taskDesc = rowData[6];
            }
            if (!string.IsNullOrEmpty(rowData[7]))
            {
                data.taskPool = int.Parse(rowData[7]);
            }
            if (!string.IsNullOrEmpty(rowData[8]))
            {
                data.areaType = int.Parse(rowData[8]);
            }
            return data;
        }
    }
}
